package com.hxx.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hxx.entity.TrainCarriageEntity;
import com.hxx.mapper.TrainCarriageMapper;
import com.hxx.service.TrainCarriageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class TrainCarriageSserviceImpl extends ServiceImpl<TrainCarriageMapper, TrainCarriageEntity>
implements TrainCarriageService {

    @Autowired
    private TrainCarriageMapper trainCarriageMapper;
    @Override
    public Page<TrainCarriageEntity> listPage(Page<TrainCarriageEntity> page, TrainCarriageEntity entity) {
        return trainCarriageMapper.selectPage(page, new LambdaQueryWrapper<TrainCarriageEntity>()
                .eq(entity.getTrainCode() != null, TrainCarriageEntity::getTrainCode, entity.getTrainCode())
        );
    }
}
